package com.project.service.imp;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.bean.GoodsBean;
import com.project.mapper.IGoodsMapper;
import com.project.service.IGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class GoodsServiceImp implements IGoodsService {
    @Autowired
    private IGoodsMapper mapper;
    @Override
    public IPage<GoodsBean> cutFindByItem(Integer pageNum, String name, String status) {
        QueryWrapper qw = new QueryWrapper<>();
        if(name!=null&&name.length()!=0){
            qw.like("g_name",name);
        }
        if(status!=null&&status.length()!=0){
            qw.like("g_status",status);
        }

        return mapper.selectPage(new Page(pageNum,3),qw);
    }
}
